<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <LINK href="images/oeu/style.css" type=text/css rel=stylesheet>
  <title>\Memory Squares\</title>
    <!--
    Memory Squares Script by Jan Mulder.
    For help or feedback contact: info@EnglishCafe.co.uk
    This script is free. You may use it as-is or modify it to suit your needs.
    Please put an acknowledgement to me (see above) somewhere in the head section
    of your page source. Some visible acknowledgement, while not necessary, is
    customary and would be nice.
    This script has been written from the ground up so
    DO NOT COPY IT AND PASS IT OFF AS YOUR OWN.
    -->
    <!--
    This is an example of a function you could use when the game is over.
    The values available are:
    numCorrect, numWrong, numAttempts, numMinutes, numSeconds, numImages, timeLeft
    -->
<SCRIPT language=JavaScript>


function wellDone()
{
  if (timeLeft > -30)
  {
    if (
       confirm(
       'Well done! You took '
       + numMinutes
       + ' minutes and '
       + numSeconds
       + ' seconds to complete the game using '
       + numAttempts
       + ' attempts. Do you want to try again?')
       ) location.reload();
  }
  else
  {
    if (
       confirm(
       'Bad luck! You ran out of time, but you managed to get '
	   + numCorrect
	   + ' out of '
	   + numImages
       + ' right. Do you want to try again?')
       ) location.reload();
   }
 
}
</SCRIPT>
    <!--
    Here is the data for the game. It must go BEFORE the game script "mpairs.js".
    ALL variables MUST be present even if they don't have a value.
    "imageWidth" and "imageHeight" contain  the size of the images. All the images
    should be the same size.
    "delay" determines how long the image pairs are displayed.
    If set to "0" they will only disappear when the cursor moves away from the
    currently visible images.
    "doneAction" is the name of the function to be called when the game is over.
    This can also be no action: doneAction = "":
    You can provide you own function somewhere in a script such as in the example
    above, or you can just use a simple inline one:
    doneAction = "alert('Well done! Now have a cup of tea.');";
    The variable you can use in a function are:
    numCorrect, numWrong, numAttempts, numMinutes, numSeconds, timeLeft
    "matchingPairs" is an array containing all the images in matching pairs.
    There is always an even number of images and matching images should be placed
    next to each other:
    "bulb.gif", "txt_bulb.gif", "socket.gif", "txt_socket.gif",...
    NOT
    "bulb.gif", "socket.gif", "txt_bulb.gif", "txt_socket.gif",...
    Apart from that they can be in any order you like because they placed in random
    order in the grid every time a new game starts.

    all modified to make it more scriptable
    this version uses one directory
    and choses randomly from all image names, no repeat
    later may add back radio buttons to chose themes
    each image would be tagged with available theme
     -->
<SCRIPT language=JavaScript>
var curdir = "images/oeu/";

var image_dict = new Array(9);
var imgcnt = 0;

 image_dict[imgcnt++] = 'EuIconx32.jpg';
 image_dict[imgcnt++] = 'win4eu.jpg';
 image_dict[imgcnt++] = 'Eu01.jpg';
 image_dict[imgcnt++] = 'eulogo.jpg';
 image_dict[imgcnt++] = 'spiral_eu.png';
 image_dict[imgcnt++] = 'spiral.png';
 image_dict[imgcnt++] = 'e_04.png';
 image_dict[imgcnt++] = 'ml3deu-03-t-t-01.png';
 image_dict[imgcnt++] = 'logo_ideas.jpg';
 image_dict[imgcnt++] = 'eu-logo1.png';
 image_dict[imgcnt++] = 'oeu5.gif';
 image_dict[imgcnt++] = 'oeu.gif';




// dotclear.gif
// style.css
// question.gif


var imageWidth = 140;
var imageHeight = 90;
var delay = 0;
var doneAction   = "wellDone();";



var dups = new Array(imgcnt);
var matchingPairs = new Array(8*2);


 var nodups = 1;  for(k in dups){ dups[k]= 0;}
 
  for( x=0; x<16; x+=2){
    imgn = Math.floor(Math.random()*imgcnt);
    if(nodups){
      do{
          if(!dups[imgn]){
              dups[imgn] = 1;  // sups[ imgn+""] should have worked
              break;
          }
        imgn = Math.floor(Math.random()*imgcnt);
      }while(true);
    }
      s = image_dict[imgn];
      matchingPairs[x] = curdir+s;
      matchingPairs[x+1] = curdir+s;
  //~ document.writeln(s)
  }

</SCRIPT>
    <!--
    The next line inserts the game script.
    It must come after the game data (above).
    -->
<SCRIPT src="images/oeu/msquares.js"></SCRIPT>
<SCRIPT language=JavaScript>
<!--
var message="Sorry, right button is disabled!";
function click(e) {
//~ if (document.all) {
//~ if (event.button==2||event.button==3) {
//~ alert(message);
//~ return false;
//~ }
//~ }
//~ if (document.layers) {
//~ if (e.which == 3) {
//~ alert(message);
//~ return false;
//~ }
//~ }
}
if (document.layers) {
 //document.captureEvents(Event.MOUSEDOWN);
}
 //document.onmousedown=click;
// -->
</SCRIPT>
  </head>
  <body>

             <!--
              Now all that is needed is to draw the grid and optionally draw the
              "Time Left" counter.
              Place them somewhere in the body of your page
              The dimensions 4,4 is the size of the grid. There are sixteen
              squares so the grid could also be 8,2 but a square shape looks better
              The amount of time allowed in this game is 120 seconds
              Omitting the drawTime(120) line gives the user unlimited.
              -->
<SCRIPT language=JavaScript>
 drawTimer(90);
 drawTable(4,4);  

</SCRIPT>
<br></b><font color=black>
<br><b>Memory Squares </b> - by Jan   Mulder., choices enhanced by ne1 2001-2010
 best time reported, around 23 seconds 14 choices.
                <br>images used are from the euforum
                and assumed to be the property of their creators
               
<noscript>   <H4>you have javascript disabled please use the right click to select back</H4> </noscript>
  <a href="javascript:history.go(-1);">Go Back</a><!-- --> |
  <a href="eu400_0001.html">Table of Contents</a></font color>
 <!--
  now works in IE6 but errors in the js when run from the chm
  157 end of for loop, this[i[ something is failing
  is it not able to find the images?
  rclick properties shows question or the image name if you click
  except the image is not showing
  this is with the added method errored commented out in the js
  which I think is only a double check the image gets loaded to show progress
  weird
	works now
	was not including the images in the hhp control file
	so being loaded from javascript the chm had no idea they were required

  -->
  </body>
</html>
